﻿@using Coevery.Relationship
@using Coevery.Relationship.Records
@using Coevery.Relationship.ViewModels
@{
    var relationships = (IList<RelatedEntityViewModel>)Enumerable.Cast<RelatedEntityViewModel>(Model.Relationships);
}
@foreach (var relationship in relationships) {
    <section class="row-fluid related-list">
        <header>
            <h5>@relationship.Label</h5>
            <div class="btn-toolbar">
                <button class="btn btn-small btn-success">
                    <i class="icon-plus"></i>&nbsp;New
                </button>
            </div>
        </header>
        <div data-ng-controller='RelatedEntityListCtrl' data-ng-init="relationId='@relationship.RelationId';relationType='@relationship.RelationType';entityTypeName='@relationship.RelatedEntityName';viewId=@relationship.ProjectionId;getRelatedData()">
            <div data-ag-grid="gridOptions" data-ag-grid-name="referenceList"></div>
        </div>
    </section>
}